package com.example.slidingtest;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class OptionArrayAdapter extends ArrayAdapter<String> {

	private final Context mContext;
	private final String[] values;

	public OptionArrayAdapter(Context context, String[] value) {
		super(context, R.layout.activity_menu, value);
		this.mContext = context;
		this.values = value;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) mContext
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View rowView = inflater.inflate(R.layout.activity_menu, parent, false);
		ImageView imaOption = (ImageView) rowView.findViewById(R.id.imaOption);
		TextView txtOption = (TextView) rowView.findViewById(R.id.txtOption);

		txtOption.setText(values[position]);
		String s = values[position];

		if (s.equals("Tất cả")) {
			imaOption.setImageResource(R.drawable.ic_launcher);
		}else if(s.equals("Nộm")){
			imaOption.setImageResource(R.drawable.ic_launcher);
		}
		return rowView;
	}
}
